<script type="text/javascript" src="__PUBLIC__/admin/js/xc.js"></script> 
<script type="text/javascript" src="__PUBLIC__/admin/js/xc.admin.js"></script>
<div class="cl pd-5 bg-1 bk-gray mb-10">
  <a onclick="layer_open('添加商品','__MODULE__/Goods/pointsAddEdit')" href="javascript:;" class="btn btn-primary radius l"><i class="Hui-iconfont">&#xe600;</i> 添加商品</a>&nbsp;&nbsp;
  <span class="r mt-3">共有数据：<strong>{$rows}</strong> 条</span>
  <span class="col-3 pl-20">
  <form id="batch" method="post">
    <select name="operate" class="input-text txt-input" style="width:100px" id="operate">
      <option value="0">批量操作</option>
      <option value="sale1">上架</option>
      <option value="sale2">下架</option>
      <option value="recom1">推荐商品</option>
      <option value="recom2">取消推荐</option>
      <option value="new1">设置新品</option>
      <option value="new2">取消新品</option>
      <option value="hot1">设置促销</option>
      <option value="hot2">取消促销</option>
    </select>
    <input type="hidden" name="selected">
    <input type="hidden" name="type">
    <a onclick="op()" href="javascript:;" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe603;</i> 确定</a>
  </form>
  </span>
</div>
<table id="xctable" class="table table-border table-bordered table-hover table-bg table-sort">
  <thead>
    <tr class="text-c">
      <th width="30"><input type="checkbox" name="" value=""></th>
      <th width="30" id="go_id" onClick="tab_sort(this)"><div class="">编号</div></th>
      <th width="500" id="go_name" onClick="tab_sort(this)"><div class="">商品信息</div></th>
      <th width="140" id="go_market" onClick="tab_sort(this)"><div class="">商品价格</div></th>
      <th width="80" id="go_stock" onClick="tab_sort(this)"><div class="">库存</div></th>
      <th width="60">操作</th>
    </tr>
  </thead>
  <tbody>
    <volist name="list" id="vo">
    <tr class="text-c">
      <td><input name="check" type="checkbox" value="{$vo.go_id}"></td>
      <td>{$i}</td>
      <td class="text-l">
        <dl style="text-align:left">
          <dt><a style="text-decoration:none" href="{:U('/Home/Index/iframe//Goods/details/id/'.$vo[go_id])}" target="_blank" title="查看">
            <img src="{$vo.go_id|goods_thum_images=400,400}" width="65" height="65" style="float:left; border-radius: 5%;" />
          </a></dt>
          <dd style="float: left; padding-left: 10px; width:80%">{$vo.go_name}<br>
            <!--<span style="color:#999; font-size:12px;"><if condition="($cate[$vo[go_caid]] neq '')">商品分类：{$cate[$vo[go_caid]]}</if></span>-->
            <p><img src="__PUBLIC__/admin/images/<if condition='$vo[go_sale] eq 1'>sj1.png<else />sj2.png</if>" onclick="changeTableValGoods('goods','go_id={$vo.go_id}','go_sale','sj',this)"/>
              <img src="__PUBLIC__/admin/images/<if condition='$vo[go_recom] eq 1'>tj1.png<else />tj2.png</if>" onclick="changeTableValGoods('goods','go_id={$vo.go_id}','go_recom','tj',this)"/>
              <img src="__PUBLIC__/admin/images/<if condition='$vo[go_new] eq 1'>xp1.png<else />xp2.png</if>" onclick="changeTableValGoods('goods','go_id={$vo.go_id}','go_new','xp',this)"/>
              <img src="__PUBLIC__/admin/images/<if condition='$vo[go_hot] eq 1'>cu1.png<else />cu2.png</if>" onclick="changeTableValGoods('goods','go_id={$vo.go_id}','go_hot','cu',this)"/>
              <img src="__PUBLIC__/admin/images/<if condition='$vo[go_gift] eq 1'>lb1.png<else />lb2.png</if>" onclick="changeTableValGoods('goods','go_id={$vo.go_id}','go_gift','lb',this)"/>
            </p>
		  </dd>
        </dl>
      </td>
      <td class="text-l" ><p style="text-align: center">零售价：{$vo.go_score}积分</p><!--<p>批发价：{$vo.go_score}积分</p>--></td>
      <td><input type="text" class="input-text text-c" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" onpaste="this.value=this.value.replace(/[^\d.]/g,'')"  onchange="ajaxUpFieldValue('goods','go_id={$vo.go_id}','go_stock',this);" value="{$vo.go_stock}" style="border-radius:5px" /></td>
      <td class="td-manage">
        <a style="text-decoration:none" href="{:U('/Home/Index/iframe//Goods/details/id/'.$vo[go_id])}" target="_blank" title="查看"><i class="Hui-iconfont">&#xe683;</i></a>
        <a onclick="layer_open('修改积分商品','__MODULE__/Goods/pointsAddEdit?id={$vo.go_id}')" href="javascript:;" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
        <a style="text-decoration:none" href="javascript:;" onclick="del(this,'{$vo.go_id}')"title="删除"><i class="Hui-iconfont">&#xe609;</i></a>
      </td>
    </tr>
    </volist>
  </tbody>
</table>
{$page}<!-- 分页-->
<script type="text/javascript">
$(".pagination a").click(function(){
	var page = $(this).data('p');
	ajax_get_table('myfrom1',page);
});
</script>
<script type="text/javascript">
/*删除*/
function del(obj, id) {
layer.confirm('确认要删除吗？', function(index) {
	$.ajax({
		type : 'post',
		url : '__MODULE__/Goods/delGoods',
		data : {id:id},
		dataType : 'json',
		success : function(res){
			if(res.status == 1){
				$(obj).parents("tr").remove();
				layer.msg('已删除!', {icon: 1,time: 1000});
			}else{
				layer.msg(res.msg, {icon: 2});
			}
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			layer.alert('网络失败，请刷新页面后重试',{icon:2});
		}
	})
});
}
</script>